package com.jch.learn.springframework.beans.factory.support;

import com.jch.learn.springframework.beans.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

// 默认单例注册实现类型
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {

    // 单例bean存储容器
    private Map<String,Object> singletonObjects = new HashMap<String, Object>();

    public Object getSingleton(String beanName) {
        return singletonObjects.get(beanName);
    }

    protected void addSingleton(String beanName,Object singletonObject){
        singletonObjects.put(beanName,singletonObject);
    }

}
